<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .city {
            display: flex;

        }

        .city div {
            margin-left: 10px;
            width: 80px;
            height: 40px;
            border-radius: 8px;
            background-color: #dedede;
            text-align: center;
            line-height: 40px;

        }

        /* .aa {
            background-color: orangered !important;

        }

        .bb {
            color: white;
        } */
        .city>div.active {
            background-color: orangered;
            color: white;
        }
       
    </style>
</head>

<body>
    <div id="app">
        <div>
            <span>区域</span> &nbsp;&nbsp;<span>{{city}}</span>
        </div>
        <div class="city">
            <div :class="{active:city=='江浙沪'}"  @click="change('江浙沪')">江浙沪</div>
            <div :class="{active:city=='珠三角'}" @click="change('珠三角')">珠三角</div>
            <div :class="{active:city=='北京'}" @click="change('北京')">北京</div>
        </div>

    </div>
    <script type="module">
        import { createApp } from "../assets/vue3/vue.esm-browser.js";
        createApp({
            data() {
                return {
                    city: '请输入城市',
                    // activeObj: {
                    //     aa: false,
                    //     bb: false
                    // },

                }
            },
            methods: {
                change(c) {
                    


                    this.city = c
                    // this.activeObj.aa = !this.activeObj.aa
                    // this.activeObj.bb = !this.activeObj.bb

                }
            }
        }).mount("#app");
    </script>
</body>

</html>